interface Room{
    /* 房间运维核心原型扩展 */
    mount_spawnID(spawnName:string[]):StructureSpawn[]
    RoleAdaption():void
    RoleAdapation_P(roleData:DicRoleData):void
    identify_room_state_01(critical_tick:number,peace_tick:number):void
    RoomState01(roleData?:DicRoleData):void
    RoomState02(roleData?:DicRoleData):void
    RoomState03(roleData?:DicRoleData):void
    RoleChangeApi():void
    RoleChangeApi_P(roleData:DicRoleData):string | void
    FrameCreepWork():void
    FrameCreepWork_P(roleData:DicRoleData):void
    /* 房间战争函数原型扩展 */
    war_plan_02():void
    war_plan_02_P(roleData:DicRoleData):void
    /* 房间规划原型扩展 */
    plan_C1(map:planData[]):void
    Role_A1(roleData:DicRoleData):void
    Role_A2():void
    getStandedPos():RoomPosition[]
    constructSourceLink():void
    create_rampart_construction_A1():void
    addStructureMemory():void
    writeBlueprint(level:number,map:planData[]):void
    getDistributionNum():number
    repatchDistribution():void
    unbindMemory(mold:BuildableStructureConstant,x:number,y:number):void
    RampartPlan2(name:string):void
    /* 房间结构函数原型扩展 */
    linkWork_A1(mode:number):void
    towerWork_A1():void

    /* 房间功能原型扩展 */
    getStructure(sc:StructureConstant):Structure[]
    getTypeStructure(sr:StructureConstant[]):Structure[]
    getHitsleast(sc:StructureConstant,mode?:number):Structure | undefined
    getListStructure(sc:StructureConstant[]):Structure[]
    getListHitsleast(sc:StructureConstant[],mode?:number):Structure | undefined
    ID(id:string):Structure | Creep | ConstructionSite | Flag | Source |Mineral
    getEnemyPos():RoomPosition[]
    serializePos(position:RoomPosition):string
    unzip(str:string):RoomPosition | undefined
    findFarSource():Source | undefined
    findNearStructure(range_:number,conList:StructureConstant[],mode:number):Structure[] | Structure | undefined
    doing(...hashMaps: object[]): void

    /* 任务模块2 */
    TaskManager2():boolean
    mountTask(role:string,task:Rtask):boolean
    delTask(role:string,taskName:string,ID?:string):boolean
    inTask(role:string,taskName:string,ID?:string):boolean
    overdue():void
    InitRM():void
    getTask(role:string,taskName:string,ID?:string):Rtask| null
    getUnfillTaskID(BigTaskRole:string,BigTaskName,role:string):string | null
    GlobalUnbind(BigTask:Rtask):void
    StructureWork():void
    // 具体任务
    LToS():void
    SToNT():void
    TToS():void
    SEF():void
    FTF():void
    FLE():void
    TToT_ACC():void
    IME_ACC():void
    RS_ACC():void
    OME_ACC():void
    RP_ACC():void
    AEAB_ACC():void
    BCT():void
    IU_ACC():void
    CL_ACC():void
    AIO_ACC():void
    /* 建筑任务 */
    LTOC():void


    TowerRangeMap():void
}

interface creepSelfAdaptationData{
    bodypart:number[]
    num:number
    level:number
    fun ?: ()=>void
}

interface roomCreepNum{
    creeprole:string
    num: number
}
interface RoomMemory{
     // 基本单位ID spawn/powerspawn/constoller/storage/terminal
    spawn1ID : string
    spawn2ID ?: string
    spawn3ID ?: string
    powerID ?: string
    controlID : string
    storageID ?: string
    terminalID ?: string
    NtowerID ?:string    // 靠近中心点的TowerID
    OtowerID ?: string[]  // 除了靠近中心点，其他所有的TowerID
    mineralID?:string
    extractID?:string
    mineralContainerID?:string
    boost_lab_1?:string
    boost_lab_2?:string
    boost_lab_3?:string
    boost_lab_4?:string
    labs?:string[]
    occ_labs?:{[key:string]:{taskID?:string[],occNum:number}}
    /* 近远矿点 */
    source1ID?:string
    source2ID?:string
     // 敌情判断计时器
    enemyTICK : number
    peaceTick : number
     // 房间状态
    roomSTATE : Room_Status
     // 房间中心点
    center_x ?: number
    center_y ?: number
    // 房间中关于爬虫信息的记忆
    creepNumData: roomCreepNum[]
    // 用于自动规划的建筑布局检测
    distribution:StructureMemory
    structureNum:number
    controlLevel?:number
    passDistribution:string[] // Todo:不计入distribuition记忆里的建筑
    terminalResource:TerminalResourceData
    //展示该房间的roleData
    showRole:boolean
    // 新任务
    missons?:RoomTaskList
    /* 寻路模块 */
    bypass?:string[]

}



interface StructureMemory{
    [Stype:string]:string[]
}


/* 任务中爬虫数量的数据 */
interface roleNumData {
    [workRole:string]:number
}

// 任务类型
type misson =  string


// 任务作用区间n
type TaskRange = "CREEP" | "STRUCTURE" | "ROOM"

/*
** 任务系统2.0 原来的任务模块过于累赘，可重复性不高并且相对比较占用cpu，这里拟设计新的任务系统
** 同样任务模块只针对ControlByFarme为false的工虫，新增了任务id，id是该任务标志+Game.time，没有id则是有且只能同时存在1个的任务
** 房间的任务系统不再是对象列表，而是字典，key是爬虫的role或者建筑的类型,value是任务列表堆
** 任务新增阶段概念： 初始化阶段 -> 执行阶段 -> 收尾阶段
** 任务新增任务绑定概念，凡是有id的任务，都必须绑定具体执行该任务爬虫的id，如果爬虫死亡任务并未完成，任务自动取消
*/

interface Rtask{
    /* ------------必选参数--------------- */
    // 任务名
    name:string
    // 超时tick
    delayTick?:number
    // 任务作用区间 爬虫？建筑？全局？
    range?:TaskRange
    // 任务优先级
    taskLevel?:number
    // 与任务有关的爬虫role或者structure
    rObject?:string[] | string
    /* ------------可选参数--------------- */
    // 任务id 绑定的爬虫id
    id?:string
    creepID?:string[]
    // 数量
    numData?:roleNumData
    // 与任务有关的资源类型
    rResource?:ResourceConstant
    // 任务执行状态 
    state?:MissonState
    // 路费
    expense?:number
    // 数量
    amount?: number
    // 目标房间
    disRoom?:string
    // 话语
    words?:string
    // 开关
    switch?: boolean
    // 上级关联任务
    linkTask?:string
    /* 以下为组队任务定制化内容 */
    // 与Creep的绑定 creep名
    bindCreep?:string[]
    /* 以下为建筑任务定制化内容 */
    structureID?:string
    /* 以下为和lab有关任务的定制化内容 */
    boostLevel?:number
    product?:ResourceConstant
    raw1?:ResourceConstant
    raw2?:ResourceConstant
    // 存放原材料的labID
    productID?:string
    raw1ID?:string
    raw2ID?:string
    relateID?:string[]
    relateOb?:{}
    dispos?:boolean
}

type MissonState = "PREPARING" | "WORKING" | "ENDING"

interface RoomTaskList {
    // 爬虫role: 与该role有关的任务列表
    [name:string]:Rtask[]
}


interface TerminalResourceData{
    [st:string]:number
}